import os
import sys
import shutil
from pathlib import Path

root = Path(__file__).absolute().parent.parent
root = root / "pcdet" / "ops" / "pointnet2" / "pointnet2_stack"
dst_file = root / "pointnet2_modules.py"

print(f"remove {dst_file}")
os.remove(dst_file)

if len(sys.argv) > 1 and sys.argv[1] == "def":
    print("def")
    src_file = root / "pointnet2_modules_def.py"
else:
    print("origin")
    src_file = root / "pointnet2_modules_origin.py"

shutil.copyfile(src_file, dst_file)
